/* game.h */

#ifndef GAME_H
#define GAME_H

#include "globals.h" // drawing functions
#include "input.h"
#include "drawing.h"
#include "sprite_handler.h"
#include "scrolling.h"
#include "timer.h"
#include "game_states.h"


////////////////////////////////////////////////////////////
// globals
////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////
// function prototypes
////////////////////////////////////////////////////////////
void Initialize();
void LoadContent();
void Update();
void Draw();


////////////////////////////////////////////////////////////
// Function: Initialize
// one time stuff; initializes (does not create) variables to be used
////////////////////////////////////////////////////////////
void Initialize()
{
}

////////////////////////////////////////////////////////////
// Function: LoadContent
// one time stuff; copies content into proper memory locations
////////////////////////////////////////////////////////////
void LoadContent()
{
    // Set up Timer
    timerInit();
	SoundInit();   
    // Set Begining Game State
    SetGameState( SPLASH_SCREEN );
}


////////////////////////////////////////////////////////////
// Function: Update
// update loop; responsible for making all necessary changes to variable values and states
////////////////////////////////////////////////////////////
void Update()
{
    // Increment the time elpased
    updateTimer();

    buttonPoll();
	
    // what is the current GameState?
    switch ( g_gameState )
    {
        case SPLASH_SCREEN:
        {
            UpdateSplashScreen();
            break;
        }
        case TITLE_SCREEN:
        {
            UpdateTitleScreen();
            break;
        }
        case GAMEMODE:
        {
            UpdateGameMode();
            break;
        }
        case VICTORY_SCREEN:
        {
            UpdateVictoryScreen();
            break;
        }
		case DEFEAT_SCREEN:
        {
            UpdateDefeatScreen();
            break;
        }
        default:
            break;
    }
}


////////////////////////////////////////////////////////////
// Function: Draw
// updates OAM and background scroll registers
////////////////////////////////////////////////////////////
void Draw()
{
	WaitVBlank();
	
	// what is the current GameState?
    switch ( g_gameState )
    {
        case SPLASH_SCREEN:
        {
            break;
        }
        case TITLE_SCREEN:
        {
            break;
        }
        case GAMEMODE:
        {
			CopySpritesIntoOAM();
			DrawScrollingBackground(); // found in scrolling.h
            break;
        }
        case VICTORY_SCREEN:
        {
            break;
        }
		case DEFEAT_SCREEN:
        {
            break;
        }
        default:
            break;
    }	
	
}

#endif

/* END OF FILE */

